﻿Public Class frmGridView
    '网格数据
    Private m_GridData(-1, -1) As String
    '行数据
    Private m_XTitle(-1) As String
    '列数据
    Private m_YTitle(-1) As String
    Property GridData() As String(,)
        Get
            Return m_GridData
        End Get
        Set(ByVal value As String(,))
            m_GridData = value
        End Set
    End Property
    Property XTitle() As String()
        Get
            Return m_XTitle
        End Get
        Set(ByVal value As String())
            m_XTitle = value
        End Set
    End Property
    ''' <summary>
    ''' 列数据
    ''' </summary>
    ''' <value></value>
    ''' <returns></returns>
    ''' <remarks></remarks>
    Property YTitle() As String()
        Get
            Return m_YTitle
        End Get
        Set(ByVal value As String())
            m_YTitle = value
        End Set
    End Property

    Private Sub frmGridView_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Me.EFlex1.Styles.Alternate.BackColor = Color.FromArgb(216, 228, 248)
        EFlex1.Rows.Count = m_YTitle.Length + 1
        EFlex1.Cols.Count = m_XTitle.Length + 1
        For i As Integer = 0 To m_XTitle.Length - 1
            EFlex1.SetData(0, i + 1, m_XTitle(i))
        Next
        For i As Integer = 0 To m_YTitle.Length - 1
            EFlex1.SetData(i + 1, 0, m_YTitle(i))
        Next

        For i As Integer = 0 To m_YTitle.Length - 1
            For j As Integer = 0 To m_XTitle.Length - 1
                EFlex1.SetData(i + 1, j + 1, GridData(i, j))
            Next
        Next
        EFlex1.AllowDragging = C1.Win.C1FlexGrid.AllowDraggingEnum.None
        EFlex1.AllowMerging = C1.Win.C1FlexGrid.AllowMergingEnum.None
        EFlex1.AllowSorting = C1.Win.C1FlexGrid.AllowSortingEnum.None
        EFlex1.AllowResizing = C1.Win.C1FlexGrid.AllowResizingEnum.Columns
        EFlex1.AutoSizeCols()
    End Sub
End Class